home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / mozilla-firefox / idl / mozITXTToHTMLConv.idl < prev    next >
Text File  |  2006-05-08  |  5KB  |  120 lines

  1. /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2.  * 
  3.  * The "License" shall be the Mozilla Public License Version 1.1, except
  4.  * Sections 6.2 and 11, but with the addition of the below defined Section 14.
  5.  * You may obtain a copy of the Mozilla Public License Version 1.1 at
  6.  * <http://www.mozilla.org/MPL/>. The contents of this file are subject to the
  7.  * License; you may not use this file except in compliance with the License.
  8.  * 
  9.  * Section 14: MISCELLANEOUS.
  10.  * This License represents the complete agreement concerning subject matter
  11.  * hereof. If any provision of this License is held to be unenforceable, such
  12.  * provision shall be reformed only to the extent necessary to make it
  13.  * enforceable. This License shall be governed by German law provisions. Any
  14.  * litigation relating to this License shall be subject to German jurisdiction.
  15.  * 
  16.  * Once Covered Code has been published under a particular version of the
  17.  * License, You may always continue to use it under the terms of that version.
  18.  + The Initial Developer and no one else has the right to modify the terms
  19.  * applicable to Covered Code created under this License.
  20.  * (End of Section 14)
  21.  * 
  22.  * Software distributed under the License is distributed on an "AS IS"
  23.  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
  24.  * License for the specific language governing rights and limitations
  25.  * under the License.
  26.  * 
  27.  * The Original Code is the Text to HTML converter code.
  28.  * 
  29.  * The Initial Developer of the Original Code is Ben Bucksch
  30.  * <http://www.bucksch.org>. Portions created by Ben Bucksch are Copyright
  31.  * (C) 1999, 2000 Ben Bucksch. All Rights Reserved.
  32.  * 
  33.  * Contributor(s):
  34.  */
  35.  
  36. /**
  37.   Description: Currently only functions to enhance plain text with HTML tags.
  38.   <p>
  39.   Wrapper class for various parsing routines, that convert plain text to HTML.
  40.   They try to recognize cites, URLs, plain text formattting like *bold* etc.
  41.   See <http://www.bucksch.org/1/projects/mozilla/16507/> for a description.
  42.  */
  43.  
  44. #include "nsIStreamConverter.idl"
  45. #include "nsrootidl.idl"
  46.  
  47. %{C++
  48. // {77c0e42a-1dd2-11b2-8ebf-edc6606f2f4b}
  49. #define MOZITXTTOHTMLCONV_CID \
  50.     { 0x77c0e42a, 0x1dd2, 0x11b2, \
  51.     { 0x8e, 0xbf, 0xed, 0xc6, 0x60, 0x6f, 0x2f, 0x4b } }
  52.     
  53. #define MOZ_TXTTOHTMLCONV_CONTRACTID \
  54.   "@mozilla.org/txttohtmlconv;1"
  55.  
  56. %}
  57.  
  58. [scriptable, uuid(77c0e42a-1dd2-11b2-8ebf-edc6606f2f4b)]
  59. interface mozITXTToHTMLConv : nsIStreamConverter {
  60.   const unsigned long kEntities = 0;  // just convert < & > to < & and >
  61.   const unsigned long kURLs = 1 << 1;
  62.   const unsigned long kGlyphSubstitution = 1 << 2;  // Smilies, ® etc.
  63.   const unsigned long kStructPhrase = 1 << 3;       // E.g. *bold* -> <strong>
  64.  
  65. /**
  66.   @param text: plain text to scan. May be a line, paragraph (recommended)
  67.                or just a substring.<p>
  68.                Must be non-escaped, pure unicode.<p>
  69.                <em>Note:</em> ScanTXT(a, o) + ScanTXT(b, o) may be !=
  70.                Scan(a + b, o)
  71.   @param whattodo: Bitfield describing the modes of operation
  72.   @result      "<", ">" and "&" are escaped and HTML tags are inserted where
  73.                appropriate.
  74.  */
  75.   wstring   scanTXT(in wstring text, in unsigned long whattodo);
  76.  
  77. /**
  78.   Adds additional formatting to user edited text, that the user was too lazy
  79.   or "unknowledged" (DELETEME: is that a word?) to make.
  80.   <p>
  81.   <em>Note:</em> Don't use kGlyphSubstitution with this function. This option
  82.   generates tags, that are unuseable for UAs other than Mozilla. This would
  83.   be a data loss bug.
  84.  
  85.   @param text: HTML source to scan. May be a line, paragraph (recommended)
  86.                or just a substring.<p>
  87.                Must be correct HTML. "<", ">" and "&" must be escaped,
  88.                other chars must be pure unicode.<p>
  89.                <em>Note:</em> ScanTXT(a, o) + ScanTXT(b, o) may be !=
  90.                Scan(a + b, o)
  91.   @param whattodo: Bitfield describing the modes of operation
  92.   @result      Additional HTML tags are inserted where appropriate.
  93.  */
  94.   wstring   scanHTML(in wstring text, in unsigned long whattodo);
  95.  
  96. /**
  97.   @param line: line in original msg, possibly starting starting with
  98.                txt quote tags like ">"
  99.   @param logLineStart: pos in line, where the real content (logical line)
  100.                begins, i.e. pos after all txt quote tags.
  101.                E.g. position of "t" in "> > text".
  102.                Initial value must be 0, unless line is not real line.
  103.   @return      Cite Level, i.e. number of txt quote tags found, i.e. number of
  104.                nested quotes.
  105.  */
  106.   unsigned long   citeLevelTXT(in wstring line,
  107.                                out unsigned long logLineStart);
  108.  
  109. /** 
  110.  @param a wide string to scan for the presence of a URL.
  111.  @param aLength --> the length of the buffer to be scanned
  112.  @param aPos --> the position in the buffer to start scanning for a url
  113.  
  114.  aStartPos --> index into the start of a url (-1 if no url found)
  115.  aEndPos --> index of the last character in the url (-1 if no url found)
  116.  */
  117.  
  118.   void findURLInPlaintext(in wstring text, in long aLength, in long aPos, out long aStartPos, out long aEndPos);
  119. };
  120.